package mspbots.next.ticket.core.points;

import lombok.Builder;
import lombok.Data;

/**
 * com.mspbots.ticket.core.grader.GradeResult
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2020/4/24
 */
@Data
@Builder
public class PointResult {

    private int point;
    private Detail detail;

    public static PointResult withDefault() {
        return PointResult.builder().build();
    }

    public PointResult point(int point) {
        this.setPoint(point);
        return this;
    }

    public PointResult detail(Detail detail) {
        this.setDetail(detail);
        return this;
    }

    @Data
    public static class Detail {
        String property;
        Object value;
        int score;

        public static Detail with(int score, Object value, String property) {
            Detail detail = new Detail();
            detail.setScore(score);
            detail.setValue(value);
            detail.setProperty(property);
            return detail;
        }

    }

}
